<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>customer_recharge</title>

  <!--  -->

  <link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <link type="text/css" rel="stylesheet" charset="UTF-8"
    href="https://translate.googleapis.com/translate_static/css/translateelement.css">
  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet"
    href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome Icons -->
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
  <!-- IonIcons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css">

  <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
  <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
</head>
<!--
`body` tag options:

  Apply one or more of the following classes to to the body tag
  to get the desired effect

  * sidebar-collapse
  * sidebar-mini
-->

<body class="hold-transition sidebar-mini">
  <div class="wrapper" id="app">
    <div class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">
                <div id="example1_wrapper" class="dataTables_wrapper dt-bootstrap4">
                  <div class="row">
                    <div class="col-sm-12">
                      <table id="example1" class="table table-bordered table-striped dataTable dtr-inline" role="grid"
                        aria-describedby="example1_info">
                        <thead>
                          <tr role="row">
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="操作: activate to sort column ascending">操作</th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="单号: activate to sort column ascending" style="">单号</th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="类型: activate to sort column ascending" style="">类型</th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="金额: activate to sort column ascending" style="">金额</th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="操作人: activate to sort column ascending" style="">操作人</th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="充值时间: activate to sort column ascending" style="">充值时间</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr role="row" class="odd" style="display: none;">
                            <td class="" tabindex="0"><i class="fas fa-book "></i>&nbsp;&nbsp;<i
                                class="fas fa-paint-brush"></i>&nbsp;&nbsp;<i class="fas  fa-trash "></i></td>
                            <td style="">Epiphany 2.20</td>
                            <td style="">Gnome</td>
                            <td style="">Epiphany 2.20</td>
                            <td style="">Gnome</td>
                            <td style="">Epiphany 2.20</td>
                          </tr>
                          <tr v-for="(recharge,index) in  recharges">
                            <td class="" tabindex="0">
                              <i class="fas fa-book "></i>&nbsp;&nbsp;
                              <a href="#" @click="updateitems(index)" onclick="show_add()"><i
                                  class="fas fa-paint-brush"></i></a>&nbsp;&nbsp;
                              <a href="#"><i class="fas  fa-trash "></i></a>
                            </td>
                            <td>{{recharge.crnu}}</td>
                            <td>{{recharge.types}}</td>
                            <td>{{recharge.money}}</td>
                            <td>{{recharge.operator}}</td>
                            <td>{{recharge.time}}</td>
                          </tr>
                        </tbody>
                        <tfoot>
                        </tfoot>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="row" id="addcard" style="display: none;">
          <div class="col-sm-12">
            <div class="card">
              <div class="card-header">
                <div class="card-tools">
                  <button @click="sendupdate(clientwindow.crid)" type="button" class="btn btn-primary">
                    添加
                  </button>
                  <button onclick="drop_add()" type="button" class="btn btn-primary">
                    退出
                  </button>
                </div>
              </div>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-4">
                    <div class="row">
                      <div class="col-md-3">
                        <p>客户：</p><br>
                        <p>单号：</p><br>
                      </div>
                      <div class="col-md-9">
                        <label>{{clientwindow.cname}}</label><br>
                        <label for="">{{windowitems.crnu}}</label><br>
                      </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="row">
                      <div class="col-md-3">
                        <p>类型：</p><br>
                        <p>金额：</p><br>
                      </div>
                      <div class="col-md-9">
                        <label>{{windowitems.types}}</label><br>
                        <input v-model="money" type="text" placeholder="1000"
                          style="width: 200px; height: 35px; display: block;"><br>
                      </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="row">
                      <div class="col-md-3">
                        <p>操作人：</p><br>
                        <p>时间：</p><br>
                      </div>
                      <div class="col-md-9">
                        <input v-model="oper" type="text" placeholder="操作人"
                          style="width: 200px; height: 35px; display: block;"><br>
                        <label>{{windowitems.time}}</label><br>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

  </div>
  <!-- ./wrapper -->

  <!-- REQUIRED SCRIPTS -->

  <!-- jQuery -->
  <script src="plugins/jquery/jquery.min.js"></script>
  <!-- Bootstrap -->
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <!-- AdminLTE -->
  <script src="dist/js/adminlte.js"></script>

  <!-- OPTIONAL SCRIPTS -->
  <script src="plugins/chart.js/Chart.min.js"></script>
  <!-- AdminLTE for demo purposes -->
  <script src="dist/js/demo.js"></script>
  <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
  <script src="dist/js/pages/dashboard3.js"></script>
  <!--  -->

  <script src="plugins/datatables/jquery.dataTables.min.js"></script>
  <script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
  <script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
  <script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
  <script src="dist/js/adminlte.min.js"></script>

  <script>
    function show_add() {
      document.getElementById("addcard").style.display = "";


    };
    function drop_add() {

      document.getElementById("addcard").style.display = "none";

    }
  </script>

  <script>

    new Vue({
      el: "#app",
      data: {
        recharges: [],
        windowitems: [],
        clientwindow: [],
        money: '',
        oper: ''
      },
      mounted() {
        axios
          .get('clientrecharge/all')
          .then(res => {
            console.info(res.data);
            this.recharges = res.data.data;

          })
      },
      methods: {
        updateitems: function (index) {

          this.windowitems = this.recharges[index];
          console.log(this.windowitems);
          this.clientwindow = this.windowitems.client;
          console.log(this.clientwindow);

        },
        sendupdate: function (crid) {


          axios({
            url: 'clientrecharge/update',
            method: 'get',
            params: {
              'money': this.money,
              'operator': this.oper,
              'crid': this.windowitems.crid
            },
          }).then(res => {


          });
        }
      }
    });
  </script>
  <script>
    $(function () {
      $("#example1").DataTable({
        "responsive": true,
        "autoWidth": false,
      });

    });
  </script>

</body>

</html>